package com.yuantu.judiciary.controller;

import com.yuantu.judiciary.common.Response;
import com.yuantu.judiciary.common.ResponseFactory;
import com.yuantu.judiciary.model.api.*;
import com.yuantu.judiciary.model.dto.CaseTaxBreakDTO;
import com.yuantu.judiciary.service.IOpenApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 外部接口调用
 *
 * @author syw
 * @since 2023-06-29
 **/
@RestController
@RequestMapping(value = "/open")
@Api(tags = "外部接口")
@RequiredArgsConstructor
public class ApiOpenController {

    private final IOpenApiService apiService;

    @ApiOperation(value = "不良记录")
    @PostMapping("/person/bad-record")
    public Response<String> personBadRecord(@RequestBody @Validated PersonBadRecordDTO data) {
        return ResponseFactory.okResponse(apiService.personBadRecord(data));
    }

    @ApiOperation(value = "制裁实体详情（根据 id）")
    @PostMapping("/sanction/by-id")
    public Response<String> sanctionById(@RequestBody @Validated SanctionByIdDTO data) {
        return ResponseFactory.okResponse(apiService.sanctionById(data));
    }

    @ApiOperation(value = "制裁实体详情（根据 name）")
    @PostMapping("/sanction/by-name")
    public Response<String> sanctionByName(@RequestBody @Valid SanctionByNameDTO data) {
        return ResponseFactory.okResponse(apiService.sanctionByName(data));
    }

    @ApiOperation(value = "制裁实体详情--暂不使用")
    @PostMapping("/sanction/info")
    public Response<String> sanctionInfo(@RequestBody @Validated SanctionInfoDTO data) {
        return ResponseFactory.okResponse(apiService.sanctionInfo(data));
    }

    @ApiOperation(value = "制裁实体列表")
    @PostMapping("/sanction/list")
    public Response<String> sanctionList(@RequestBody @Validated SanctionByNameDTO data) {
        return ResponseFactory.okResponse(apiService.sanctionList(data));
    }

    @ApiOperation(value = "司法涉诉")
    @PostMapping("/judicial-involvement")
    public Response<String> judicialInvolvement(@RequestBody @Validated JudicialInvolvementDTO data) {
        return ResponseFactory.okResponse(apiService.judicialInvolvement(data));
    }

    @ApiOperation(value = "工商基础信息")
    @PostMapping("/company/info")
    public Response<String> companyInfo(@RequestBody @Validated CompanyInfoDTO data) {
        return ResponseFactory.okResponse(apiService.companyInfo(data));
    }

    @ApiOperation(value = "限制高消费")
    @PostMapping("/limit-high")
    public Response<String> limitHigh(@RequestBody @Validated LimitHighDTO data) {
        return ResponseFactory.okResponse(apiService.limitHigh(data));
    }

    @ApiOperation(value = "失信信息")
    @PostMapping("/dishonest-info")
    public Response<String> dishonestInfo(@RequestBody @Validated DisHonestInfoDTO data) {
        return ResponseFactory.okResponse(apiService.dishonestInfo(data));
    }

    @ApiOperation(value = "企业名录")
    @PostMapping("/enterprise-list")
    public Response<String> enterpriseList(@RequestBody @Validated EnterpriseListDTO data) {
        return ResponseFactory.okResponse(apiService.enterpriseList(data));
    }

    @ApiOperation(value = "获取人脸识别h5")
    @PostMapping("/face-recognition")
    public Response<String> faceRecognition(@RequestBody @Validated PersonFaceRecognitionDTO data) {
        return ResponseFactory.okResponse(apiService.faceRecognition(data));
    }

    @ApiOperation(value = "获取人脸识别结果")
    @PostMapping("/face-recognition/result")
    public Response<String> faceRecognitionResult(@RequestBody @Validated PersonFaceRecognitionResultDTO data) {
        return ResponseFactory.okResponse(apiService.faceRecognitionResult(data));
    }

    @ApiOperation(value = "不良记录-线上")
    @PostMapping("/person/bad-record/prod")
    public Response<String> personBadRecordProd(@RequestBody @Validated PersonBadRecordDTO data) {
        return ResponseFactory.okResponse(apiService.personBadRecordProd(data));
    }

    @ApiOperation(value = "司法涉诉-线上")
    @PostMapping("/judicial-involvement/prod")
    public Response<String> judicialInvolvementProd(@RequestBody @Validated JudicialInvolvementDTO data) {
        return ResponseFactory.okResponse(apiService.judicialInvolvementProd(data));
    }

    @ApiOperation(value = "商冲-线上")
    @PostMapping("/person/business/prod")
    public Response<String> personBusinessProd(@RequestBody @Validated PersonBadRecordDTO data) {
        return ResponseFactory.okResponse(apiService.personBusinessProd(data));
    }

    @ApiOperation(value = "工商基础信息-线上")
    @PostMapping("/company/info/prod")
    public Response<String> companyInfoProd(@RequestBody @Validated CompanyInfoDTO data) {
        return ResponseFactory.okResponse(apiService.companyInfoProd(data));
    }

    @ApiOperation(value = "司法涉诉(全量)-线上")
    @PostMapping("/judicial/prod")
    public Response<String> judicialProd(@RequestBody @Validated JudicialInvolvementDTO data) {
        return ResponseFactory.okResponse(apiService.judicialProd(data));
    }

    @ApiOperation(value = "企业名录-线上")
    @PostMapping("/enterprise-list/prod")
    public Response<String> enterpriseListProd(@RequestBody @Validated EnterpriseListDTO data) {
        return ResponseFactory.okResponse(apiService.enterpriseListProd(data));
    }

    @ApiOperation(value = "企业案件数量统计-线上")
    @PostMapping("/enterprise-case/prod")
    public Response<String> enterpriseCaseProd(@RequestBody @Validated EnterpriseCaseDTO data) {
        return ResponseFactory.okResponse(apiService.enterpriseCaseProd(data));
    }

    @ApiOperation(value = "个人监控名单添加-线上")
    @PostMapping("/monitor/person/add")
    public Response<Boolean> personAddMonitorProd(@RequestBody @Validated MonitorPersonAddDTO data) {
        return ResponseFactory.okResponse(apiService.personAddMonitorProd(data));
    }


    @ApiOperation(value = "个人监控名单移除-线上")
    @PostMapping("/monitor/person/remove")
    public Response<Boolean> personRemoveMonitorProd(@RequestBody @Validated MonitorPersonAddDTO data) {
        return ResponseFactory.okResponse(apiService.personRemoveMonitorProd(data));
    }


    @ApiOperation(value = "个人监控名单添加查询-线上")
    @PostMapping("/monitor/person/find")
    public Response<MonitorFindResultDTO> personFindMonitorProd(@RequestBody @Validated MonitorFindPageDTO data) {
        return ResponseFactory.okResponse(apiService.personFindMonitorProd(data));
    }

    @ApiOperation(value = "个人监控案件信息查询-线上")
    @PostMapping("/monitor/person/query")
    public Response<MonitorQueryResultDTO> personQueryMonitorProd(@RequestBody @Validated MonitorQueryPageDTO data) {
        return ResponseFactory.okResponse(apiService.personQueryMonitorProd(data));
    }


    @ApiOperation(value = "企业监控名单添加-线上")
    @PostMapping("/monitor/enter/add")
    public Response<Boolean> enterAddMonitorProd(@RequestBody @Validated MonitorEnterAddDTO data) {
        return ResponseFactory.okResponse(apiService.enterAddMonitorProd(data));
    }


    @ApiOperation(value = "企业监控名单删除-线上")
    @PostMapping("/monitor/enter/remove")
    public Response<Boolean> enterRemoveMonitorProd(@RequestBody @Validated MonitorEnterAddDTO data) {
        return ResponseFactory.okResponse(apiService.enterRemoveMonitorProd(data));
    }

    @ApiOperation(value = "企业监控名单添加查询-线上")
    @PostMapping("/monitor/enter/find")
    public Response<MonitorFindResultDTO> enterFindMonitorProd(@RequestBody @Validated MonitorFindPageDTO data) {
        return ResponseFactory.okResponse(apiService.enterFindMonitorProd(data));
    }


    @ApiOperation(value = "企业监控案件信息查询-线上")
    @PostMapping("/monitor/enter/query")
    public Response<MonitorQueryResultDTO> enterQueryMonitorProd(@RequestBody @Validated MonitorQueryPageDTO data) {
        return ResponseFactory.okResponse(apiService.enterQueryMonitorProd(data));
    }

    @ApiOperation(value = "企业税收违法信息查询-线上")
    @PostMapping("/tax/break/enter/query")
    public Response<String> enterQueryTaxBreakProd(@RequestBody @Validated CompanyTaxBreakQueryDTO data) {
        return ResponseFactory.okResponse(apiService.enterQueryTaxBreakProd(data));
    }

    @ApiOperation(value = "企业行政处罚信息查询-线上")
    @PostMapping("/admin/punish/enter/query")
    public Response<String> enterQueryAdminPunishProd(@RequestBody @Validated CompanyAdminPunishPageQueryDTO data) {
        return ResponseFactory.okResponse(apiService.enterQueryAdminPunishProd(data));
    }


}
